---
title: 'CLI'
sidebarTitle: 'CLI'
icon: 'terminal'
---

### Install the Nango CLI

Install the Nango CLI globally:
```bash
npm install nango -g
```

In the folder where you want your integration folder (e.g. root of your project), run:
```bash
nango init nango-integrations
```

This creates the `./nango-integrations` folder with some initial configuration and an example
sync script. The `nango-integrations` directory looks like this:
```
nango-integrations/
├── .env
├── index.ts
└── demo-github-integration # this is the integration unique ID and must match an integration ID in the UI
    └── syncs/
        └── github-issue-example.ts
```

### CLI Authentication

Add the following env vars. We recommend that you have a `.env` file in `./nango-integrations`:
```bash
NANGO_SECRET_KEY_PROD='<prod-secret-key>'
NANGO_SECRET_KEY_DEV='<dev-secret-key>'
```

Get your `prod` and `dev` secret keys from the [Environment Settings tab](https://app.nango.dev/environment-settings) (toggle between the `prod` and `dev` environment in the left nav bar).

<Info>
For self-hosting, set the `NANGO_HOSTPORT` env variable to `http://localhost:3003` (for local development) or your instance's URL.
</Info>

## All CLI commands & command details

Check out all CLI commands by running:
```bash
nango
```

Get details about a specific command by running:
```bash
nango [command] --help
```

## Flags & environment variables

Global command flags:

```bash
# Command flag to auto-confirm all prompts (useful for CI).
# Note: Destructive changes (like removing a sync or renaming a model) requires confirmation, even when --auto-confirm is set. To bypass this restriction, the --allow-destructive flag can be passed to nango deploy.
--auto-confirm
```

Environment variables:
```bash
# Recommendation: in a ".env" file in ./nango-integrations.

# Authenticates the CLI (get the keys in the dashboard's Environment Settings).
NANGO_SECRET_KEY_DEV=xxxx-xxx-xxxx
NANGO_SECRET_KEY_PROD=xxxx-xxx-xxxx

# Nango's instance URL (OSS: change to http://localhost:3003 or your instance URL).
NANGO_HOSTPORT=https://api.nango.dev # Default value

# How to handle CLI upgrades ("prompt", "auto" or "ignore").
NANGO_CLI_UPGRADE_MODE=prompt # Default value

# Whether to prompt before deployments.
# Note: Destructive changes (like removing a sync or renaming a model) requires confirmation, even when NANGO_DEPLOY_AUTO_CONFIRM is set to true. To bypass this restriction, the --allow-destructive flag can be passed to nango deploy.
NANGO_DEPLOY_AUTO_CONFIRM=false # Default value
```

<Tip>
**Questions, problems, feedback?** Please reach out in the [Slack community](https://nango.dev/slack).
</Tip>

